import Vue from 'vue'
import Vuex from 'vuex'
import {mapState} from 'vuex';
import { from } from '_array-flatten@2.1.2@array-flatten';
// import '../assets/css/global.styl';

Vue.use(Vuex)


export default new Vuex.Store({
    state:{
        user:{
            username:(localStorage.getItem('user')=="null"||localStorage.getItem('user')==null||localStorage.getItem('user')=='')?'尚未登录':JSON.parse(localStorage.getItem('user')).username
            },
        rs:[],
        face:{
            userface:(localStorage.getItem('userface')=="null"||localStorage.getItem('userface')==null||localStorage.getItem('userface')=='')?'尚未登录':JSON.parse(localStorage.getItem('user')).userface
        }
    },mutations:{
            login(store,user,face){
                store.user = user;
                localStorage.setItem('user',JSON.stringify(user));
                store.face=face;
                localStorage.setItem('username',JSON.stringify(face));
            },initMenu(store,routers){
                store.rs = routers;
            }
    }
})